﻿using System;

namespace Program16
{
   public class Program
   {
        //定义一个委托
        public delegate void SayHi(string name);

        private static void Main(string[] args)
        {
            //调用中文打招呼
            Hello("火花", SayHiChinese);

            //调用英文打招呼
            Hello("Michael", SayHiEnglish);
        }

        public static void Hello(string name, SayHi delegateSayHi)
        {
            //委托方法的调用
            delegateSayHi(name);
        }

        public static void SayHiChinese(string name)
        {
            Console.WriteLine("{0}，你好！很高兴遇见你", name);
        }

        public static void SayHiEnglish(string name)
        {
            Console.WriteLine("Nice to see you, {0}!", name);
        }
   }
}
